package com.irenty.interview.datastructures;

/**
 * 1.2 Write code to reverse a C-Style String. (C-String means that “abcd” is
 * represented as five characters, including the null character.)
 * 
 * @author irenty
 * 
 */
public class ReverseCharacters {
	public static char[] reverse(char[] characters) {
		int lastCharIndex = characters.length - 1;
		for (int i = 0; i < characters.length / 2; i ++) {
			char temp = characters[i];
			characters[i] = characters[lastCharIndex];
			characters[lastCharIndex--] = temp;
		}
		return characters;
	}
}
